package edu.corn.common.util;

import cn.hutool.core.util.ObjectUtil;

import java.util.List;
import java.util.Map;
import java.util.function.Consumer;


public class AssertUtil {

    public static <T> void requireNonNull(T obj, Consumer<T> action) {
        if (ObjectUtil.isEmpty(obj)) {
            action.accept(obj);
        }
    }
    public static <T extends List<?>> void requireNonEmpty(T obj, Consumer<T> action) {
        if (ObjectUtil.isEmpty(obj) || obj.isEmpty()) {
            action.accept(obj);
        }
    }
    public static <T extends Map<?,?>> void requireNonEmpty(T obj, Consumer<T> action) {
        if (ObjectUtil.isEmpty(obj) || obj.isEmpty()) {
            action.accept(obj);
        }
    }


}
